<template>
  <div class="box">
    <div class="head">
      <h3>修改用户信息</h3>
    </div>
    <div class="content">
      <div class="input-box">
        <div class="username">
          <label for="username">用户名</label>
          <input type="text" id="username" v-model="changeUsername" />
        </div>
        <div class="password">
          <label for="password">密码</label>
          <input type="password" id="password" v-model="changePassword" />
        </div>
      </div>
      <div class="btn-box">
        <button
          @click="
            changeTheUser({
              username: changeUsername,
              password: changePassword,
            })
          ">
          确定
        </button>
        <button @click="showChangeUser">取消</button>
      </div>
    </div>
  </div>
</template>

<script setup>
import { useMapgisStore_zxh } from '@/stores/mapgis-zxh.js'
import { storeToRefs } from 'pinia'
const { changeUsername, changePassword } = storeToRefs(useMapgisStore_zxh())
const { showChangeUser, changeTheUser } = useMapgisStore_zxh()
</script>

<style scoped>
.box {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 400px;
  height: 300px;
  background-color: #fff;
  border-radius: 10px;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
  z-index: 1001;
}
.head {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 50px;
  background-color: #f5f5f5;
}
.content {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px;
}
.input-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 300px;
  margin-bottom: 20px;
}
.username,
.password {
  display: flex;
  flex-direction: column;
  margin-bottom: 10px;
}
.username label,
.password label {
  font-size: 14px;
  margin-bottom: 5px;
}
.username input,
.password input {
  width: 200px;
  padding: 5px;
  border: 1px solid #ccc;
  border-radius: 5px;
}
.btn-box {
  display: flex;
  justify-content: space-between;
  width: 300px;
  margin-top: 20px;
}
button {
  padding: 10px 20px;
  background-color: #4caf50;
  color: #fff;
  border: none;
  border-radius: 5px;
  cursor: pointer;
}
</style>
